<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  	 <title>jbpm工作流系统</title>
<link href="<%= request.getContextPath() %>/liger/lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />  
<link href="<%= request.getContextPath() %>/liger/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/liger/lib/ligerUI/skins/Silvery/css/style.css" rel="stylesheet" type="text/css" />  
<script src="<%= request.getContextPath() %>/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>    
<script src="<%= request.getContextPath() %>/liger/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
 <style type="text/css">
        *{ padding:0; margin:0;}
        body{ text-align:center; background:#4974A4;}
        #login{ width:740px; margin:0 auto; font-size:12px;}
        #loginlogo{ width:700px; height:100px; overflow:hidden; background:url('') no-repeat; margin-top:50px;   }
        #loginpanel{ width:729px; position:relative;height:300px;}
        .panel-h{ width:729px; height:20px; background:url('img/login/panel-h.gif') no-repeat; position:absolute; top:0px; left:0px; z-index:3;}
        .panel-f{ width:729px; height:13px; background:url('img/login/panel-f.gif') no-repeat; position:absolute; bottom:-5px; left:0px; z-index:3;}
        .panel-c{ z-index:2;background:url('img/login/panel-c.gif') repeat-y;width:729px; height:300px;}
        .panel-c-l{ position:absolute; left:60px; top:40px;}
        .panel-c-r{ position:absolute; right:20px; top:50px; width:222px; line-height:200%; text-align:left;}
        .panel-c-l h3{ color:#556A85; margin-bottom:10px;}
        .panel-c-l td{ padding:7px;}
        
        
        .login-text{ height:24px; left:24px; border:1px solid #e9e9e9; background:#f9f9f9;}
        .login-text-focus{ border:1px solid #E6BF73;}
        .login-btn{width:114px; height:29px; color:#E9FFFF; line-height:29px; background:url('img/login/login-btn.gif') no-repeat; border:none; overflow:hidden; cursor:pointer;}
        #txtUsername,#txtPassword{ width:191px;} 
        #logincopyright{ text-align:center; color:White; margin-top:50px;}
    </style>
    <script type="text/javascript">
    	//获取QueryString的数组
		function getQueryString()
		{
		    var result = location.search.match(new RegExp("[\?\&][^\?\&]+=[^\?\&]+", "g"));
		    if (result == null)
		    {
		        return "";
		    }
		    for (var i = 0; i < result.length; i++)
		    {
		        result[i] = result[i].substring(1);
		    }
		    return result;
		}
		//根据QueryString参数名称获取值
		function getQueryStringByName(name)
		{
		    var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
		    if (result == null || result.length < 1)
		    {
		        return "";
		    }
		    return result[1];
		}
		//根据QueryString参数索引获取值
		function getQueryStringByIndex(index)
		{
		    if (index == null)
		    {
		        return "";
		    }
		    var queryStringList = getQueryString();
		    if (index >= queryStringList.length)
		    {
		        return "";
		    }
		    var result = queryStringList[index];
		    var startIndex = result.indexOf("=") + 1;
		    result = result.substring(startIndex);
		    return result;
		}

        var FromUrl = getQueryStringByName("FromUrl");
        if (!FromUrl)
        {
        	//linkController.do?index
            FromUrl = encodeURIComponent("loginController.do?loginCheck");
        }
        $(function ()
        {
            $(".login-text").focus(function ()
            {
                $(this).addClass("login-text-focus");
            }).blur(function ()
            {
                $(this).removeClass("login-text-focus");
            });

            $(document).keydown(function (e)
            {
                if (e.keyCode == 13)
                {
                    dologin();
                }
            });

            $("#btnLogin").click(function ()
            {
                dologin();
            });


            function dologin()
            {
                var username = $("#txtUsername").val();
                var password = $("#txtPassword").val();
                
                if (username == "")
                {
                    alert('账号不能为空!');
                    $("#txtUsername").focus();
                    return;
                }
                if (password == "")
                {
                    alert('密码不能为空!');
                    $("#txtPassword").focus();
                    return;
                }
                
                $.ajax({
                    type: 'post', 
                    cache: false, 
                    dataType: 'json',
                    url: 'loginController.do?login',
                    data: $('#theForm').serialize(),
                    success: function (msg)
                    {
                        if (!msg.success)
                        {
                            alert('登陆失败,账号或密码有误!');
                            $("#txtUsername").focus();
                            return;
                        } else
                        {
                            location.href = decodeURIComponent(FromUrl);
                        }
                       
                    },
                    error: function ()
                    {
                        alert('发送系统错误,请与系统管理员联系!');
                    },
                    beforeSend: function ()
                    {
                        $.ligerDialog.waitting("正在登陆中,请稍后...");
                        $("#btnLogin").attr("disabled", true);
                    },
                    complete: function ()
                    {
                        $.ligerDialog.closeWaitting();
                        $("#btnLogin").attr("disabled", false);
                    }
                });
            }

            $("#txtUsername").focus();
        });
    </script>
</head>
<body style="padding:10px;background:#ffffff;"> 
    <div id="login" >
        <div id="loginlogo"></div>
        <div id="loginpanel" style="background-color:#004080;color:#ffffff;" >
            <!-- <div class="panel-h"></div> -->
            <div >
                <div class="panel-c-l" >
                    <form id="theForm">
                    	<table cellpadding="0" cellspacing="0">
                        <tbody>
                         <tr>
                            <td align="left" colspan="2"> 
                             <div style="letter-spacing:3px;color:#ffffff;">
                             <h2><font color="#ffffff">丽水移动人力资源管理平台</font></h2>
                             </div>
                             <br>
                            </td>
                            </tr> 
                            <tr>
                            <td align="right">账号：</td><td align="left"><input type="text" name="loginCode" id="txtUsername" class="login-text" value="admin" /></td>
                            </tr>
                            <tr>
                            <td align="right">密码：</td><td align="left"><input type="password" name="loginPass" id="txtPassword" class="login-text" value="lsyd" /></td>
                            </tr> 
                            <tr>
                            <td align="center" colspan="2">
                                <input type="submit" id="btnLogin" value="登陆" class="login-btn" />
                            </td>
                            </tr> 
                        </tbody>
                    </table>
                    </form>
                </div>
                <div class="panel-c-r">
                <p>请从左侧输入登录账号和密码登录</p>
                <p>如果遇到系统问题，请联系网络管理员。</p>
                <p>如果没有账号，请联系网站管理员。 </p>
                <p>......</p>
                </div>
            </div>
            <!-- <div class="panel-f"></div> -->
        </div>
    </div>
</body>
</html>
     